/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package KFP;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author $alama
 */
@Entity
@Table(name = "bill_item")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "BillItem.findAll", query = "SELECT b FROM BillItem b"),
    @NamedQuery(name = "BillItem.findByIdBillItem", query = "SELECT b FROM BillItem b WHERE b.idBillItem = :idBillItem"),
    @NamedQuery(name = "BillItem.findByItemAmount", query = "SELECT b FROM BillItem b WHERE b.itemAmount = :itemAmount"),
    @NamedQuery(name = "BillItem.findByItemPrice", query = "SELECT b FROM BillItem b WHERE b.itemPrice = :itemPrice"),
    @NamedQuery(name = "BillItem.findByTotalPrice", query = "SELECT b FROM BillItem b WHERE b.totalPrice = :totalPrice"),
    @NamedQuery(name = "BillItem.findByItemEXPDate", query = "SELECT b FROM BillItem b WHERE b.itemEXPDate = :itemEXPDate"),
    @NamedQuery(name = "BillItem.findByPackageCount", query = "SELECT b FROM BillItem b WHERE b.packageCount = :packageCount"),
    @NamedQuery(name = "BillItem.findByExportBill", query = "SELECT b FROM BillItem b WHERE b.exportBill = :exportBill")})
public class BillItem implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "idBill_Item")
    private Integer idBillItem;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "itemAmount")
    private Double itemAmount;
    @Column(name = "itemPrice")
    private Double itemPrice;
    @Column(name = "totalPrice")
    private Double totalPrice;
    @Column(name = "itemEXPDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date itemEXPDate;
    @Column(name = "packageCount")
    private Integer packageCount;
    @Column(name = "exportBill")
    private Integer exportBill;
    @JoinColumn(name = "itemID", referencedColumnName = "idItem")
    @ManyToOne
    private Item itemID;
    @JoinColumn(name = "factoryID", referencedColumnName = "idFactory")
    @ManyToOne
    private Factory factoryID;
    @JoinColumn(name = "billID", referencedColumnName = "idBill")
    @ManyToOne
    private Bill billID;

    public BillItem() {
    }

    public BillItem(Integer idBillItem) {
        this.idBillItem = idBillItem;
    }

    public Integer getIdBillItem() {
        return idBillItem;
    }

    public void setIdBillItem(Integer idBillItem) {
        this.idBillItem = idBillItem;
    }

    public Double getItemAmount() {
        return itemAmount;
    }

    public void setItemAmount(Double itemAmount) {
        this.itemAmount = itemAmount;
    }

    public Double getItemPrice() {
        return itemPrice;
    }

    public void setItemPrice(Double itemPrice) {
        this.itemPrice = itemPrice;
    }

    public Double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(Double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public Date getItemEXPDate() {
        return itemEXPDate;
    }

    public void setItemEXPDate(Date itemEXPDate) {
        this.itemEXPDate = itemEXPDate;
    }

    public Integer getPackageCount() {
        return packageCount;
    }

    public void setPackageCount(Integer packageCount) {
        this.packageCount = packageCount;
    }

    public Integer getExportBill() {
        return exportBill;
    }

    public void setExportBill(Integer exportBill) {
        this.exportBill = exportBill;
    }

    public Item getItemID() {
        return itemID;
    }

    public void setItemID(Item itemID) {
        this.itemID = itemID;
    }

    public Factory getFactoryID() {
        return factoryID;
    }

    public void setFactoryID(Factory factoryID) {
        this.factoryID = factoryID;
    }

    public Bill getBillID() {
        return billID;
    }

    public void setBillID(Bill billID) {
        this.billID = billID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idBillItem != null ? idBillItem.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BillItem)) {
            return false;
        }
        BillItem other = (BillItem) object;
        if ((this.idBillItem == null && other.idBillItem != null) || (this.idBillItem != null && !this.idBillItem.equals(other.idBillItem))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "KFP.BillItem[ idBillItem=" + idBillItem + " ]";
    }
    
}
